Skip to content

,System.Int32)} ,System.Int32,System.Action{-1})} ,System.Int32,System.Collections.Generic.IEqualityComparer{-0})} ,System.Int32,System.Action{-1},System.Collections.Generic.IEqualityComparer{-0})}

MemoizingMRUCache(Func, int) constructor

Defined in

Type: MemoizingMRUCache Namespace: Splat Assembly: Splat.Logging.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471

Overloads

  • 1. public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize)
  • 2. public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal> onRelease)
  • 3. public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, IEqualityComparer<TParam> paramComparer)
  • 4. public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal>? onRelease, IEqualityComparer<TParam> paramComparer)

1. Overload

public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize)

View source

Summary: Initializes a new instance of the MemoizingMRUCache class.

Parameters

NameTypeDescription
calculationFuncFuncThe calculation function used to produce values for missing keys.
maxSizeintThe maximum number of entries retained in the cache. Must be > 0.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown when calculationFunc is null.
System.ArgumentOutOfRangeExceptionThrown when maxSize is less than or equal to zero.

2. Overload

public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal> onRelease)

View source

Summary: Initializes a new instance of the MemoizingMRUCache class.

Parameters

NameTypeDescription
calculationFuncFuncThe calculation function used to produce values for missing keys.
maxSizeintThe maximum number of entries retained in the cache. Must be > 0.
onReleaseActionCallback invoked when an entry is evicted or invalidated.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown when calculationFunc or onRelease is null.
System.ArgumentOutOfRangeExceptionThrown when maxSize is less than or equal to zero.

3. Overload

public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, IEqualityComparer<TParam> paramComparer)

View source

Summary: Initializes a new instance of the MemoizingMRUCache class.

Parameters

NameTypeDescription
calculationFuncFuncThe calculation function used to produce values for missing keys.
maxSizeintThe maximum number of entries retained in the cache. Must be > 0.
paramComparerIEqualityComparerEquality comparer for keys.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown when calculationFunc or paramComparer is null.
System.ArgumentOutOfRangeExceptionThrown when maxSize is less than or equal to zero.

4. Overload

public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal>? onRelease, IEqualityComparer<TParam> paramComparer)

View source

Summary: Initializes a new instance of the MemoizingMRUCache class.

Parameters

NameTypeDescription
calculationFuncFuncThe calculation function used to produce values for missing keys.
maxSizeintThe maximum number of entries retained in the cache. Must be > 0.
onReleaseAction?Optional callback invoked when an entry is evicted or invalidated.
paramComparerIEqualityComparerEquality comparer for keys.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown when calculationFunc or paramComparer is null.
System.ArgumentOutOfRangeExceptionThrown when maxSize is less than or equal to zero.